package com.bitoon.basketdudes.jpa;


import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * @author PacoFELC 2012
 */
@Entity
@Table(name = "ignorado", schema = "central")
@NamedQueries({
    @NamedQuery(name = "Ignorado.findAll"           , query = "SELECT v FROM Ignorado v"),
    @NamedQuery(name = "Ignorado.countAll"          , query = "SELECT count(v) FROM Ignorado v WHERE v.ignoradoPK.propietario = :propietario"),
    @NamedQuery(name = "Ignorado.findByPropietario" , query = "SELECT v FROM Ignorado v WHERE v.ignoradoPK.propietario = :propietario"),
    @NamedQuery(name = "Ignorado.findElemento"      , query = "SELECT v FROM Ignorado v WHERE v.ignoradoPK.propietario = :propietario and v.ignoradoPK.usuarioId = :usuario_id")
})
public class Ignorado implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected IgnoradoPK ignoradoPK;

    public Ignorado() {
    }

    public Ignorado(IgnoradoPK ignoradoPK) {
        this.ignoradoPK = ignoradoPK;
    }

    public Ignorado( int propietario, int usuarioId ) {
        this.ignoradoPK = new IgnoradoPK( propietario, usuarioId);
    }

    public IgnoradoPK getIgnoradoPK() {
        return ignoradoPK;
    }

    public void setIgnoradoPK(IgnoradoPK ignoradoPK) {
        this.ignoradoPK = ignoradoPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ignoradoPK != null ? ignoradoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ignorado)) {
            return false;
        }
        Ignorado other = (Ignorado) object;
        if ((this.ignoradoPK == null && other.ignoradoPK != null) || (this.ignoradoPK != null && !this.ignoradoPK.equals(other.ignoradoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.Ignorado[ignoradoPK=" + ignoradoPK + "]";
    }

}
